<%@ Page Language="C#" MasterPageFile="~/Employee/Employee.master" AutoEventWireup="true" CodeFile="CustomerManager.aspx.cs" Inherits="Customer" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table style="width: 286px">
        <tr>
            <td colspan="4">
                <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label><br />
                <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="XX-Large" Text="Customers Manager"></asp:Label></td>
        </tr>
        <tr>
            <td colspan="1" style="width: 130px">
                Customer's name:
            </td>
            <td colspan="3" style="width: 281px">
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
                    Display="Dynamic" ErrorMessage="Customer Name cannot be blank"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td colspan="1" style="width: 130px">
                Address:
            </td>
            <td colspan="3" style="width: 281px">
                <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2"
                    Display="Dynamic" ErrorMessage="Address cannot be blank"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td colspan="1" style="width: 130px">
                Telephone:
            </td>
            <td colspan="3" style="width: 281px">
                <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="TextBox3"
                    Display="Dynamic" ErrorMessage="Telephone cannot be blank"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td colspan="1" style="width: 130px">
                Email:</td>
            <td colspan="3" style="width: 281px">
                <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBox4"
                    Display="Dynamic" ErrorMessage="Email cannot be blank"></asp:RequiredFieldValidator></td>
        </tr>
        <tr>
            <td align="right" colspan="1" style="width: 130px; height: 51px">
                </td>
            <td colspan="3" style="height: 51px; width: 281px;">
                <asp:Button ID="Button1" runat="server" Text="  Add  " OnClick="Button1_Click" /></td>
        </tr>
        <tr>
            <td colspan="4" rowspan="2">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3"
                    DataKeyNames="CustID" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px">
                    <Columns>
                        <asp:BoundField DataField="CustID" HeaderText="CustID" InsertVisible="False" ReadOnly="True"
                            SortExpression="CustID" />
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                        <asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />
                        <asp:BoundField DataField="Tel" HeaderText="Tel" SortExpression="Tel" />
                        <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                        <asp:CommandField ShowEditButton="True" />
                        <asp:CommandField ShowDeleteButton="True" />
                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" />
                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="#CCCCCC" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Con %>"
                    SelectCommand="SELECT * FROM [Customer]" DeleteCommand="DELETE FROM [Customer] WHERE [CustID] = @CustID" InsertCommand="INSERT INTO [Customer] ([Name], [Address], [Tel], [Email]) VALUES (@Name, @Address, @Tel, @Email)" UpdateCommand="UPDATE [Customer] SET [Name] = @Name, [Address] = @Address, [Tel] = @Tel, [Email] = @Email WHERE [CustID] = @CustID">
                    <DeleteParameters>
                        <asp:Parameter Name="CustID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Address" Type="String" />
                        <asp:Parameter Name="Tel" Type="String" />
                        <asp:Parameter Name="Email" Type="String" />
                        <asp:Parameter Name="CustID" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Address" Type="String" />
                        <asp:Parameter Name="Tel" Type="String" />
                        <asp:Parameter Name="Email" Type="String" />
                    </InsertParameters>
                </asp:SqlDataSource>
            </td>
        </tr>
        <tr>
        </tr>
    </table>
</asp:Content>

